#include <iostream>
#include <assert.h>
#include "asl.h"
using namespace std;

extern "C"
{
    typedef void (*_fun0)();
    typedef void (*_fun1)(int);
    typedef void (*_fun2)(int, int);
    typedef void (*_fun3)(int, int, void*);
}


ASL_LIBRARY_BEGIN(Test)
ASL_SYMBOL_EXPLICIT(_fun0, fun0)
ASL_SYMBOL_OPTIONAL(_fun1, fun1)
ASL_SYMBOL_OPTIONAL(_fun2, fun2)
ASL_SYMBOL_EXPLICIT_T(fun3)
ASL_LIBRARY_END()

int main(int argc, char *argv[])
{
    using namespace std;

    Test test;

    try
    {
        test.Load(ASL_LIBRARY_NAME("funs"));
    }
    catch (const ASL::LibraryNotFoundException& e)
    {
        cout << "Lib not found " <<  e.what() << endl;
    }
    catch (const ASL::SymbolNotFoundException& e)
    {
        cout << "Sym not found " <<  e.what() << endl;
    }

    assert(test.fun0 != NULL);
    test.fun0();
    int a = 1, b = 2;
    test.fun1(a);
    test.fun2(a, b);
    test.fun3<void>(ASL_ARGS_T((int)a, (int)b, (void*)NULL));

	getchar();
}
